#include <unistd.h>
#include <signal.h>

/* You should write it in every program that uses avOS.
   Timers and sleep functions rely on this variable    */
int jiffies = 0;

/* Linux uses signals to handle periodic "ticks" */
void sigalrm_handler(int signum)
{
	jiffies++; /* Increase jiffies */
	signal(SIGALRM, sigalrm_handler); /* Restart timer */
	alarm(1);
}

void hw_init_timer(void)
{
	/* Start timer - interval 1 sec */
	signal(SIGALRM, sigalrm_handler);
	alarm(1);
}
